package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class MessageBoard {

    public static final int STATUS_TYPE_APPOINT = 0;  // 为回复
    public static final int STATUS_TYPE_PERFORM = 1;  // 已回复
    /** */
    private Long id;

    /** 昵称*/
    private String nickname;

    /** 留言内容*/
    private String content;

    /** 留言时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JSONField(format = "yyyy-MM-dd HH:mm")  //在JSON.toJSONString(this);时候有效
    private Date createTime;

    /** 预约业务*/
    private Integer categoryId;

    private SystemDictionary category;

    /** 回复状态(未回复/已回复)*/
    private Integer replystatus;

    public String getReplystatusDisplay(){
        switch (replystatus){
            case STATUS_TYPE_APPOINT : return "未回复";
            case STATUS_TYPE_PERFORM : return "已回复";
            default: return "异常状态";
        }
    }


    public String toJson(){
        return  JSON.toJSONString(this);
    }
}